The 'atms' resource for your effect contains two sets of information. The first set contains the "standard information" that is used to construct the standard parameters dialog box. This includes items such as the title of the dialog box, and optional copyright information.
The second set contains the "parameter information," which is a description of each parameter that your effect takes. If your effect does not take parameters, there will be no information in this set.
The structure of an 'atms' resource is as follows. The header for this resource contains the resource ID and the number of root level atoms it contains:
resource 'atms' (kEffectatmsRes) {
7,
{
// The resource body goes here
};
};
The first line contains the ID of the 'atms' resource. In this example, the identifier that is used ( kEffectatmsRes ) is also used in the call to GetComponentResource in Listing 19 . This ensures that the right 'atms' resource is read by QuickTime.
The second line contains the number of root atoms in the resource. Each 'atms' resource contains a number of atoms. The number in the second line must contain a count of the number of first-level atoms in the resource.
It is important that you ensure this number is updated if you add and delete atoms from your 'atms' resource. If this number is smaller than the number of atoms actually in the resource, you will not be able to adjust the values of all the parameters of the effect. If the number is larger than the number of atoms in your effect, your effect component may cause QuickTime to crash when it is used.
The body of the 'atms' resource consists of a number of atom declarations. Each declaration has a header that contains:
The header is followed by the atom's data, which is either one or more typed values, such as a string or a long , or a set of child atoms.
Listing 20 shows an example atom that contains a single typed value as its data. Note that the value is a type followed by the data itself. The number of children of the atom is declared as noChildren because the atom contains a typed value.
Listing 20 An example 'atms' atom declaration
kParameterTitleName, kParameterTitleID, noChildren,
{
string { "Dimmer2 Effect Parameters" };
};
The Standard Information stored in an 'atms' resource is made up of three required atoms and five optional atoms.
For each parameter of the effect your 'atms' resource must contain a set of atoms in the 'atms' resource that describes that parameter. This description includes the name of the parameters, the type and range of values it can take and hints on appropriate user interface that client applications should present to allow users to edit this parameter.
A complete description of the information you need to provide for each parameter can be found in "The Parameter Description Format" .
For a basic parameter, there are five atoms that you should supply:
An example of a basic parameter description is shown in Listing 21 .
Listing 21 An example set of parameter description atoms
kParameterAtomTypeAndID, 101, noChildren,
{
OSType { "sden" }; // atomType - the name of this parameter
long { "1" }; // atomID - this is atom number 1
kAtomNotInterpolated; // atomFlags - this parameter cannot be tweened
string { "Scratch Density" }; // atomName - the name of the parameter
// as it will appear in the standard parameters dialog box
};
kParameterDataType, 101, noChildren,
{
kParameterTypeDataLong; // dataType - this parameter contains a
// long value
};
kParameterDataRange, 101, noChildren,
{
long { "0" }; // Minimum value
long { "25" }; // Maximum value
long { "1" }; // Scale factor - no scaling is applied to this
// parameter
long { "0" }; // Precision - 0 indicates that this parameter is
// not a floating point value
};
kParameterDataBehavior, 101, noChildren,
{
kParameterItemControl; // behavior type - this parameters should be
// represented by a slider
long { "0" }; // behaviorFlags - no flags
};
kParameterDataDefaultItem, 101, noChildren,
{
long { "5" }; // The default value of the parameter
};
| Previous | Chapter Contents | Chapter Top | Next |